-
-
Notifications
You must be signed in to change notification settings - Fork 38
feat: add CustomRuleVisitorWithExit type to @eslint/plugin-kit
#351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to export CustomRuleVisitorWithExit from packages/plugin-it/source-code.js, probably like this:
/** @typedef {import("@eslint/core").RuleVisitor} RuleVisitor */
/**
* @typedef {import("./types.ts").CustomRuleVisitorWithExit<RuleVisitorType>} CustomRuleVisitorWithExit<RuleVisitorType>
* @template {RuleVisitor} RuleVisitorType
*/The next step is ensuring that packages/plugin-kit/dist/cjs/index.d.cts references import("./types.cts") instead of import("./types.ts"). This kind of substitution is already being done in tools/build-cts.js, but only for static imports:
Lines 27 to 30 in f8df139
| const newSourceText = oldSourceText.replaceAll( | |
| ' from "./types.ts";\n', | |
| ' from "./types.cts";\n', | |
| ); |
fasttime
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! Leaving open for a second review.
lumirlumir
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Prerequisites checklist
What is the purpose of this pull request?
This PR adds a
CustomRuleVisitorWithExittype to the@eslint/plugin-kitpackage to address the need for a shared type that can generate exit selectors for rule visitors. Currently, each language plugin (JavaScript, JSON, CSS, Markdown) has to reimplement this same helper type separately.What changes did you make? (Give an overview)
CustomRuleVisitorWithExittype.CustomRuleVisitorWithExitRelated Issues
Fixes #318
Is there anything you'd like reviewers to focus on?